<?php

namespace App\Http\Resources;


use Illuminate\Http\Resources\Json\ResourceCollection;

class RoleCollection extends ResourceCollection
{
    public function toArray($request)
    {
        return [
            'list'=>$this->collection->transform(function ($item) {
                return [
                    'id' => $item->id,
                    'code' => $item->code,
                    'name' => $item->name,
                    'status' => $item->status,
                    'value' => $item->value,
                    'sort' => $item->sort,
                    'createTime' => $item->create_time ,
                    'updateTime' => $item->update_time
                ];
            }),
            'total' => $this->total(), //数据总数
        ];
    }
}

